import request from '@/config/axios'

export interface SceneConfigVO {
  id: number
  name: string
  type: string
  remark: string
}

export interface StepVO {
  id: number
  label: string
  content: string
  type: string
  nextStepId: string
  sceneId: string
}

// 查询场景列表
export const getScenePage = async (params) => {
  return await request.get({ url: `/service/scene-config/page`, params })
}

// 查询场景详情
export const getSceneDetail = async (id: number) => {
  return await request.get({ url: `/service/welcome-config/get?id=` + id })
}

// 新增场景
export const createScene = async (data: SceneConfigVO) => {
  return await request.post({ url: `/service/scene-config/create`, data })
}

// 修改场景
export const updateScene = async (data: SceneConfigVO) => {
  return await request.put({ url: `/service/scene-config/update`, data })
}

// 删除场景
export const deleteScene = async (id: number) => {
  return await request.delete({ url: `/service/scene-config/delete?id=` + id })
}

// 新增步骤
export const createStep = async (data: StepVO) => {
  return await request.post({ url: `/service/step-config/create`, data })
}
// 更新
export const updateStep = async (data: StepVO) => {
  return await request.put({ url: `/service/step-config/update`, data })
}

// 查询场景下步骤列表
export const getSceneStepPage = async (sceneId: number) => {
  return await request.get({ url: `/service/step-config/simple-list?sceneId=` + sceneId })
}

// 查询场景下步骤详情
export const getSceneStepDetail = async (id: number) => {
  return await request.get({ url: `/service/step-config/get?id=` + id })
}
// 删除场景下步骤
export const deleteSceneStep = async (id: number) => {
  return await request.delete({ url: `/service/step-config/delete?id=` + id })
}

// 查询场景列表子
export const getSceneChildPage = async (type: number) => {
  return await request.get({ url: `/service/scene-config/simple-list?type=` + type  })
}
// 新增表单
export const createStepForm = async (data) => {
  return await request.post({ url: `/service/step-form/create`, data })
}
// 更新表单
export const updateStepForm = async (data) => {
  return await request.put({ url: `/service/step-form/update`, data })
}
// 获取表单
export const getSceneStepForm = async (id: number) => {
  return await request.get({ url: `/service/step-form/get-by-step?stepId=` + id })
}